#include <iostream>
using namespace std;
template<typename T>
void sort (T a[], const int size, int b)
{T x;
	for(int i=0;i<size;i++)
	{
		for(int j=size-1;j>i;j--)
		{ 
			
			if(a[j-1]>a[j]&&b==0||a[j-1]<a[j]&&b>0)
			{
			x=a[j-1];
			a[j-1]=a[j];
			a[j]=x;
			}
			
		}
	}
}
void main()
{
	const int size=10;
	int a[size]={6,5,6,7,8,9,0,8,7,6};
	int b;
	cout<<"enter 0 for ascending 1 for descending sort";
	cin>>b;
	for(int i=0;i<size;i++)
		{cout<<a[i];}
	sort(a,size,b);
	cout<<"\n";
		for(int i=0;i<size;i++)
		{cout<<a[i];}
	cout<<"\n";
}